//
//  DropDownViewController.m
//  MultiSegmentController
//
//  Created by ET|冰琳 on 16/5/24.
//  Copyright © 2016年 Binglin. All rights reserved.
//

#import "DropDownViewController.h"
#import "BIMultiSegmentControl.h"
#import "MultiCustomSegmentView.h"

@interface DropDownViewController ()<MultiSegmentSplitViewDataSource>

@end

@implementation DropDownViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    EqualWSegmentControl *control = [[EqualWSegmentControl alloc] initWithFrame:CGRectMake(0, 0, 320, 44.f) titles:@[@"red",@"blue",@"green",@"yellow"]];
    control.bottomlineView.hidden = NO;
    control.indicatorView = ({UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(control.frame)-5, 10, 5.f)];
        view.backgroundColor = [UIColor orangeColor];
        view;
    });
    control.backgroundColor = [UIColor lightTextColor];
    
    MultiCustomSegmentView * container = [[MultiCustomSegmentView alloc] initWithSegmentControl:control];
    container.dataSource = self;
    container.dropContainer = self.view;
    [self.view addSubview:container];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


-(NSInteger)componentNumberAtSegmentIndex:(NSInteger)segmentIndex{
    if (segmentIndex == 0) {
        return 2;
    }
    return 1;
}

- (NSInteger)numberOfRowsInComponent:(NSInteger)component AtSegmentIndex:(NSInteger)segmentIndex{
    return 10;
}

- (NSString *)titleForCellAtSegmentIndex:(NSInteger)segmentIndex component:(NSInteger)component row:(NSInteger)row{
    if (segmentIndex == 1) {
        return @"haha";
    }else if (segmentIndex == 2){
        return @"12345";
    }
    return @"abc";
}

//- (CGFloat)rowHeightInComponent:(NSInteger)component AtSegmentIndex:(NSInteger)segmentIndex;
//- (CGFloat)widthForRowInComponent:(NSInteger)component AtSegmentIndex:(NSInteger)segmentIndex;
//- (CGFloat)heightForSplitViewAtSegmentIndex:(NSInteger)segmentIndex;

- (void)didSelectAtSegmentIndex:(NSInteger)segmentIndex component:(NSInteger)segmentIndex row:(NSInteger)row{
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
